package com.fortune.controller;

import com.faneui.common.bean.BaseResp;
import com.faneui.common.exception.BusinessException;
import com.fortune.dal.dao.BankDAO;
import com.fortune.dal.model.Bank;
import com.fortune.service.ScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("test")
public class TestController extends AbstractController {

    @Autowired
    private BankDAO bankDAO;

    @Autowired
    private ScheduleService scheduleService;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public ModelAndView indexOfAll() throws BusinessException {
        ModelAndView mv = new ModelAndView("test");
        mv.addObject("menuFlag", "test");
        return mv;
    }

    @RequestMapping(value = "/1", method = RequestMethod.GET)
    @ResponseBody
    public BaseResp list(@ModelAttribute Bank bank) throws BusinessException {
        BaseResp resp = new BaseResp();
        try {
            String email = "983243113@qq.com";
            String password = "parufoxnqygmbcjb" ;
            scheduleService.loadEmail(1,email,password);
        }catch (Exception ex) {
            logger.error("",ex);
            resp.setMsg(ex.getMessage());
            resp.setSuccess(false);
        }
        return resp;
    }


}
